package com.aspose.cells;

import java.util.ArrayList;

class zbap extends zayy {
   byte[] f;
   ArrayList g;

   zbap() {
   }

   zbap(String var1, byte[] var2) {
      this.c = var1;
      this.f = var2;
   }

   zbap(String var1, byte[] var2, int var3) {
      this.c = var1;
      this.f = var2;
      this.d = var3;
   }

   boolean e() {
      return false;
   }

   boolean f() {
      return true;
   }

   boolean g() {
      return false;
   }

   byte[] h() {
      return this.f;
   }

   void a(byte[] var1) {
      this.f = var1;
      this.g = null;
   }

   ArrayList i() {
      return this.g;
   }

   void a(ArrayList var1) {
      this.g = var1;
   }

   boolean j() {
      return this.f != null;
   }

   void a(Cells var1, Style var2, StyleFlag var3) {
      int var4;
      if (this.g != null && this.g.size() > 0) {
         for(var4 = 0; var4 < this.g.size(); ++var4) {
            FontSetting var5 = (FontSetting)this.g.get(var4);
            zakq.a(var2, var5.getFont(), var3);
         }
      }

      if (this.f != null && this.f.length > 0) {
         for(var4 = 0; var4 < this.f.length; var4 += 4) {
            int var8 = com.aspose.cells.b.a.zc.e(this.f, var4) & '\uffff';
            if (var8 >= this.c.length()) {
               return;
            }

            int var6 = com.aspose.cells.b.a.zc.e(this.f, var4 + 2) & '\uffff';
            Font var7 = var1.r().j(var6);
            zakq.a(var2, var7, var3);
            var6 = var1.r().b(var7);
            System.arraycopy(com.aspose.cells.b.a.zc.a(var6), 0, this.f, var4 + 2, 2);
         }
      }

   }

   void a(zbap var1, Cell var2) {
      this.a(var1.f, var2);
   }

   void a(byte[] var1, Cell var2) {
      this.f = null;
      if (var1 != null) {
         ArrayList var3 = new ArrayList();

         for(int var4 = 0; var4 < var1.length; var4 += 4) {
            int var5 = com.aspose.cells.b.a.zc.e(var1, var4) & '\uffff';
            if (var5 >= this.c.length()) {
               this.a(var3);
               return;
            }

            if (var4 == 0 && var5 != 0) {
               FontSetting var6 = new FontSetting(0, var5, var2.d.r(), false);
               var6.getFont().c(var2.p().getFont());
               com.aspose.cells.b.a.a.ze.a(var3, (Object)var6);
            }

            int var9 = com.aspose.cells.b.a.zc.e(var1, var4 + 2) & '\uffff';
            boolean var7 = false;
            int var10;
            if (var4 + 4 >= var1.length) {
               var10 = this.c.length() - var5;
            } else {
               var10 = (com.aspose.cells.b.a.zc.e(var1, var4 + 4) & '\uffff') - var5;
            }

            FontSetting var8 = new FontSetting(var5, var10, var2.d.r(), false);
            var8.getFont().c(var2.d.r().j(var9));
            com.aspose.cells.b.a.a.ze.a(var3, (Object)var8);
         }

         this.g = var3;
      } else {
         this.g = new ArrayList();
      }

   }

   void a(Cell var1) {
      this.a(this.f, var1);
      this.f = null;
   }

   void a(Cell var1, zbap var2, Cell var3) {
      this.c = var2.c;
      this.g = new ArrayList();
      this.f = null;
      ArrayList var4 = var2.a(var1.d.r(), var1.j().length(), var1.p().getFont());

      for(int var5 = 0; var5 < var4.size(); ++var5) {
         FontSetting var6 = (FontSetting)var4.get(var5);
         FontSetting var7 = new FontSetting(var6.getStartIndex(), var6.getLength(), var3.d.r(), false);
         var7.getFont().c(var6.c());
         com.aspose.cells.b.a.a.ze.a(this.g, (Object)var7);
      }

   }

   ArrayList a(WorksheetCollection var1, int var2, Font var3) {
      if (this.g != null && this.g.size() != 0) {
         zbar.a(this.g, var2, var3, false);
         FontSetting var12 = (FontSetting)this.g.get(0);
         if (var12.getStartIndex() != 0) {
            FontSetting var13 = new FontSetting(0, var12.getStartIndex(), var1, false);
            var13.getFont().c(var3);
            this.g.add(0, var13);
         }

         return this.g;
      } else if (this.f != null) {
         byte[] var4 = this.f;
         ArrayList var5 = new ArrayList();

         for(int var6 = 0; var6 < var4.length; var6 += 4) {
            int var7 = com.aspose.cells.b.a.zc.e(var4, var6) & '\uffff';
            FontSetting var8;
            if (var7 >= this.c.length()) {
               if (var6 == 0) {
                  var8 = new FontSetting(0, this.c.length(), var1, false);
                  var8.getFont().c(var3);
                  com.aspose.cells.b.a.a.ze.a(var5, (Object)var8);
               }

               return var5;
            }

            if (var6 == 0 && var7 != 0) {
               var8 = new FontSetting(0, var7, var1, false);
               var8.getFont().c(var3);
               com.aspose.cells.b.a.a.ze.a(var5, (Object)var8);
            }

            int var14 = com.aspose.cells.b.a.zc.e(var4, var6 + 2) & '\uffff';
            boolean var9 = false;
            int var15;
            if (var6 + 4 >= var4.length) {
               var15 = this.c.length() - var7;
            } else {
               var15 = (com.aspose.cells.b.a.zc.e(var4, var6 + 4) & '\uffff') - var7;
            }

            if (var7 + var15 > this.c.length()) {
               var15 = this.c.length() - var7;
            }

            if (var15 > 0) {
               Font var10 = null;
               if (var14 < 0) {
                  var10 = null;
               } else {
                  if (var14 > 4) {
                     --var14;
                  }

                  if (var14 >= var1.z().size()) {
                     var10 = (Font)((Font)var1.z().get(0));
                  } else {
                     var10 = (Font)((Font)var1.z().get(var14));
                  }
               }

               FontSetting var11 = new FontSetting(var7, var15, var1, false);
               if (var10 != null) {
                  var11.getFont().c(var10);
               }

               com.aspose.cells.b.a.a.ze.a(var5, (Object)var11);
            }
         }

         return var5;
      } else {
         return null;
      }
   }

   boolean a(String var1, byte[] var2) {
      if (com.aspose.cells.b.a.zv.b(this.c, var1) && this.f != null) {
         byte[] var3 = this.f;
         if (var3.length == var2.length) {
            boolean var4 = true;

            for(int var5 = 0; var5 < var2.length; ++var5) {
               if (var3[var5] != var2[var5]) {
                  var4 = false;
                  break;
               }
            }

            if (var4) {
               return true;
            }
         }
      }

      return false;
   }
}
